package behavioral.memento;

import lombok.Data;

/**
 * @Description: 文档类
 * @Author: lxt
 * @CreateDate: 2019/11/1
 **/
@Data
public class Document {
    private String titile;
    private String body;

    public Document(String title, String body) {
        this.body = body;
        this.titile = title;
    }

    public Memento memento() {
        return new Memento(this);
    }

    public void recovery(Memento memento) {
        this.titile = memento.getTitle();
        this.body = memento.getBody();
    }
}
